package com.abc.robot01.vivemodel

import android.util.Log
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.abc.robot01.retrofit.RetrofitService
import com.abc.robot01.retrofit.bean.HouseType
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch


class YingZhuangViewModel : ViewModel() {

    val TAG = "报价明细"

    var renderConfigId  =   mutableStateOf("")

    var isExpanded  =  mutableStateOf(true)

    var isExpanded2  =  mutableStateOf(true)

    var isExpanded3  =  mutableStateOf(true)

    //喜好
    private val _question2List = MutableStateFlow<List<HouseType>>(mutableListOf(HouseType()))

    val question2List: StateFlow<List<HouseType>> = _question2List

    //选择户型
    private val _question3List = MutableStateFlow<List<HouseType>>(emptyList())
    val question3List: StateFlow<List<HouseType>> = _question3List

    //风格
    private val _question4List = MutableStateFlow<List<HouseType>>(mutableListOf(HouseType()))
    val question4List: StateFlow<List<HouseType>> = _question4List

        /**
         * 当前是否是公库.
        * */
    val isPublic =  mutableStateOf(false)

    val name  = mutableStateOf("")

    val interestsCode  = mutableStateOf("")
    val interests  = mutableStateOf("全部")

    //风格
    val styleCode  = mutableStateOf("")
    val style  = mutableStateOf("全部")

//选择户型
    val styleCode2  = mutableStateOf("")
    val style2  = mutableStateOf("全部")

    fun  load(){
        viewModelScope.launch {
            val a = RetrofitService.instance.getDetails(
                id =2,
                renderConfigId = renderConfigId.value,
                accessToken = Robot.accessToken,
                userId = Robot.userId,
                companyId = Robot.companyId,
            ).string()
//            price.value = a.data.zh
            Log.e(TAG, "基础装修 ；报价明细： :$a")
        }
    }



}

